<%@ page language="java" contentType="text/html; charset=utf-8"
	 pageEncoding="utf-8"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ZZTY</title>
<link rel="stylesheet"
	href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
<script
	src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>



<link href="/SpringMVCMybatis/css/bootstrap-datetimepicker.css"
	rel="stylesheet" />
<link href="/SpringMVCMybatis/css/bootstrap.css" rel="stylesheet" />
<link href="/SpringMVCMybatis/css/bootstrap.min.css" rel="stylesheet" />
<link href="/SpringMVCMybatis/css/custom.css" rel="stylesheet" />
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
<script>
$.ajax({
	type:"GET",
	url:"../User/ajaxGetUserInfo",
	success:function(data){
		var res = JSON.parse(data)
			var userName = res.User.name;
			var disname = res.User.disname;
			var email = res.User.email;
			var phone = res.User.phone;
			var sex = res.User.sex;
			var clazz = res.User.clazzId;
	 		$("#name1").html(userName);
	 		$("#disname1").html(disname);
	 		$("#email1").html(email);
	 		$("#phone1").html(phone);
	 		$("#sex1").html(sex);
	 		$("#clazz1").html(clazz);
	 		
	 		$("#disname").val(disname);
	 		$("#email").val(email);
	 		$("#phone").val(phone);
	 		
	},
	error:function(data){
	}
})

	function a() {
		var phone = $("#phone").val();
		var disname = $("#disname").val();
		var email = $("#email").val();
		if (phone.length != 11 || disname.length < 1 || email.length < 1) {
			alert("信息填写错误或不能为空");
			return false;

		} else {
			return true;

		}

	}
	function b() {
		var photo = document.all.Photo.value;
		if (photo == " " || photo == null) {
			alert("提交照片不能为空");
			return false;
		} else {
			return true;
		}

	}
</script>
</head>
<body>
	
	<div id="wrapper">
		<nav class="navbar navbar-default navbar-cls-top " role="navigation"
			style="margin-bottom: 0">
			<div class="navbar-header">
				
				<a class="navbar-brand">自在天原</a>
			</div>
			<div
				style="color: white;padding: 15px 50px 5px 50px;float: right;font-size: 16px;">
				<form action="../loginOut.jsp" method="post">
					<button type="submit" class="btn btn-danger">注销</button>
				</form>
			</div>
		</nav>
		<!-- /. NAV TOP  -->
		<nav class="navbar-default navbar-side" role="navigation">
			<div class="sidebar-collapse">
				<ul class="nav" id="main-menu">
					<li class="text-center">
						</li>


					<li><a href="../StudentPageSkip/index"><i
							class="fa fa-dashboard fa-3x"></i> 主页</a></li>
					<li><a href="../StudentPageSkip/UserInfo"><i class="fa fa-table fa-3x"></i>
							个人信息</a></li>
					<li><a href="../StudentPageSkip/SelfExam"><i class="fa fa-desktop fa-3x"></i>
							今日竞赛</a></li>
					<li><a href="../StudentPageSkip/TeamExam"><i class="fa fa-qrcode fa-3x"></i>
							今日结对</a></li>
					<li><a href="../StudentPageSkip/History"><i
							class="fa fa-bar-chart-o fa-3x"></i> 历史记录</a></li>

					<li><a href="../StudentPageSkip/ChangePassword"><i
							class="fa fa-edit fa-3x"></i> 密码修改 </a></li>

				</ul>

			</div>

		</nav>
		<!-- /. NAV SIDE  -->
		<div id="page-wrapper">
			<div id="page-inner">
				<div class="row">
					<div class="col-md-12">
						<div class="table-responsive">
							<table class="table" id = "t1">
								<caption>
									<h2>个人信息</h2>
								</caption>

								<thead>
									<tr>
										<th>账号</th>
										<td><label id = "name1"></label></td>
									</tr>
								</thead>
								<tbody>
									<tr>
										<th>姓名</th>
										<td><label id = "disname1"></label></td>
									</tr>
									<tr>
									<tr>
										<th>邮箱</th>
										<td><label id = "email1"></label></td>
									</tr>
									<tr>
										<th>手机</th>
										<td><label id = "phone1"></label></td>
									</tr>
									<tr>
										<th>性别</th>
										<td><label id = "sex1"></label></td>
									</tr>
									<tr>
										<th>班级</th>
										<td><label id = "clazz1"></label></td>
									</tr>
								</tbody>
							</table>
							<button class="btn btn-primary btn-lg" data-toggle="modal"
								data-target="#myModal">修改信息</button>
						</div>

					</div>
				</div>
				<!-- /. ROW  -->
				<hr />

			</div>
			<!-- /. PAGE INNER  -->
		</div>
		<!-- /. PAGE WRAPPER  -->
	</div>
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title" id="myModalLabel">修改用户信息</h4>
				</div>
				<form action="../User/updateUserInfo" method="post"
					onsubmit="return a()">
					<div class="modal-body">
						<div class="table-responsive">
							<table class="table">

								<tr>
									<th>姓名</th>
									<td><input type="text" class="form-control" id="disname"
										name="disname" placeholder="请输入姓名" value=""></td>
								</tr>
								<tr>
									<th>邮箱</th>
									<td><input type="email" class="form-control" name="email" id = "email"
										placeholder="请输入邮箱" value=""></td>
								</tr>
								<tr>
									<th>手机</th>
									<td><input type="text" class="form-control" name="phone" id = "phone"
										onkeyup="value=value.replace(/[^\d]/g,'')" placeholder="请输入手机"
										value=""></td>
								</tr>
								<tr>
									<th>性别</th>
									<td><label><input name="sex" type="radio" id = "sex"
											value="boy" checked="checked" />男 </label> <label><input
											name="sex1" type="radio" value="girl" />女<br> </label></td>
								</tr>
								<tr>
									<th>班级</th>
									<td><select name="clazzId" id = "clazzId">
											<option value="4">4班</option>
											<option value="5">5班</option>
											<option value="6">6班</option>
											<option value="7">7班</option>
											<option value="8">8班</option>
									</select></td>
								</tr>
							</table>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">
							关闭</button>
						<input type="submit" class="btn btn-primary" value="提交更改">
					</div>
				</form>

			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->

	<div class="modal fade" id="myModal1" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title" id="myModalLabel">修改用户信息</h4>
				</div>
				

			</div>
			<!-- /.modal-content -->
		</div>
		<!-- /.modal-dialog -->
	</div>
	<!-- /.modal -->

	<!-- /. WRAPPER  -->
	<!-- SCRIPTS -AT THE BOTOM TO REDUCE THE LOAD TIME-->
	<!-- JQUERY SCRIPTS -->
	<!-- BOOTSTRAP SCRIPTS -->
	<script src="../js/bootstrap.min.js"></script>
	<!-- METISMENU SCRIPTS -->
	<script src="../js/jquery.metisMenu.js"></script>



</body>
</html>
